//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;

namespace Eas.WebCrawler.Model.Gateway {
    internal class BaseWebRequest : Eas.WebCrawler.Interfaces.WebRequestInterface{

        public BaseWebRequest(System.Net.WebRequest webRequest) {
            _WebRequest = webRequest;
        }

        /// <summary>The underlying webrequest</summary>
        /// <remarks>Backing field for the WebRequest property.</remarks>
        /// <seealso cref="WebRequest"/>
        private System.Net.WebRequest _WebRequest;

        /// <summary>The underlying webrequest</summary>
        public System.Net.WebRequest WebRequest {
            get { return _WebRequest; }
        }

        #region WebRequestInterface Members

        public IAsyncResult BeginGetResponse(AsyncCallback callback, object state) {
            return _WebRequest.BeginGetResponse(callback, state);
        }

        public Eas.WebCrawler.Interfaces.WebResponseInterface EndGetResponse(IAsyncResult result) {
            return new BaseWebResponse(_WebRequest.EndGetResponse(result));
        }

        public void Abort() {
            _WebRequest.Abort();
        }

        #endregion
    }
}
